1. Technical Field
The present invention relates in general to data processing systems and in particular to a method and system for enabling state save and debug operations.
2. Description of the Related Art
An operating system (OS) typically separates a virtual memory into a kernel space and a user space. The kernel space is typically reserved for running the kernel, kernel extensions, and device drivers, while the user space is reserved for user mode applications. In order to track and control the execution of multiple processes, the OS utilizes a call stack (also referred to as an execution stack) to store information regarding the active subroutines of a computer program. The call stack monitors the execution of multiple processes by keeping track of the points to which each active subroutine should return control after the executions of the active subroutines have been completed.
A co-routine may be utilized to facilitate the porting of code into a set of microcode operating in the kernel space of an OS such that the ported code does not need to be restructured in order to run asynchronously in an event driven (or scan loop) environment. Several co-routine wrappers that executed the ported code on different contexts (or stacks) suspend a corresponding operation when an asynchronous call back is needed from code in the event driven environment. At a call back, the co-routine wrapper restores the context of the corresponding ported code, and the ported code proceeds as if the interrupting function call had been executed immediately. To facilitate the porting of code, an OS often needs to restructure the code to run in a new environment (e.g., by providing conversions to enable operation in a non-native asynchronous environment).